package udp

import "net"

// UDPData 缓存接收到的UDP数据
type UDPData struct {
	RemoteAddr *net.UDPAddr // 发送方地址
	Data       []byte       // 数据
}

// Device ...
type Device struct {
	addr      *net.UDPAddr
	isConnect bool
}

// SetAddr
func (d *Device) SetAddr(addr *net.UDPAddr) {
	d.addr = addr
	d.isConnect = true
}

// Addr ...
func (d *Device) Addr() *net.UDPAddr {
	return d.addr
}

// IsConnect ...
func (d *Device) IsConnect() bool {
	return d.isConnect
}

// DisConnect ...
func (d *Device) DisConnect() {
	d.isConnect = false
}
